//
//  MyMessageCell.m
//  HubeiHotel
//
//  Created by LiBenCan on 17/11/22.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "MyMessageCell.h"
@interface MyMessageCell ()
@property (nonatomic,strong)UILabel *titleLab;//标题
@property (nonatomic,strong)UILabel *timeLab;//时间
@property (nonatomic,strong)UILabel *lineLab;//画线
@end
@implementation MyMessageCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {//先调用父类
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor whiteColor];
        [self CreatUI];
    }
    return self;
}
-(void)CreatUI
{
    if (!_titleLab) {//底层不存在加载执行
        
        //标题
        _titleLab = [TomamaUI createLabel:CGRectMake(0,0,0,0) textAligment:0 font:[UIFont systemFontOfSize:17] textColor:TextBlack text:@""];
        _titleLab.numberOfLines = 0;
        _titleLab.userInteractionEnabled = YES;
        [self.contentView addSubview:_titleLab];
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15 * screenW_6);
            make.right.equalTo(self.contentView).offset(-15 * screenW_6);
            make.top.equalTo(self.contentView).offset(15*screenW_6);
        }];
        
        //时间
        _timeLab = [TomamaUI createLabel:CGRectMake(0,0,0,0) textAligment:0 font:[UIFont systemFontOfSize:13*screenW_6] textColor:TextGray text:@""];
        [self.contentView addSubview:_timeLab];
        _timeLab.userInteractionEnabled = YES;
        [self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15 * screenW_6);
            make.right.equalTo(self.contentView).offset(-15 * screenW_6);
            make.top.equalTo(self.titleLab.mas_bottom).offset(10*screenW_6);
        }];
        
        //画线
        _lineLab = [UILabel new];
        _lineLab.backgroundColor = LineColor;
        _lineLab.text = @" ";
        [self.contentView  addSubview:_lineLab];
        [_lineLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@0);
            make.right.equalTo(@0);
            make.height.equalTo(@1);
            make.top.equalTo(_timeLab.mas_bottom).offset(15*screenW_6);
            make.bottom.equalTo(self.contentView).offset(0);
        }];
    }
    
}
//数据加载
-(void)setDataDic:(NSDictionary *)dataDic
{
    self.titleLab.text = dataDic[@"title"];//标题
    self.timeLab.text = dataDic[@"createDate"];//创建时间
}


@end
